package ILTypes;

import java.util.ArrayList;
import java.util.List;

public class ILClass {

	public boolean isPublic, isFinal, isInterface, isSuper, isAbstract, entryClass;
	private int access;
	private String name;
	private String signature;
	private String version;
	private String superName;
	private String[] interfaces;
	private List<String> printInstructions;
	
	public ILClass()
	{
		printInstructions = new ArrayList<String>();
		SetFlags(0);
	}

	public ILClass(int clsAccess, String clsName, String clsSign, String clsSuperName)
	{
		access = clsAccess;
		name = clsName;
		signature = clsSign;
		superName = clsSuperName;
		printInstructions = new ArrayList<String>();
		SetFlags(clsAccess);
	}
	
	public ILClass(int clsAccess, String clsName, String clsSign, String clsSuperName, String clsVersion, String[] clsInterfaces)
	{
		access = clsAccess;
		name = clsName;
		signature = clsSign;
		superName = clsSuperName;
		version = clsVersion;
		interfaces = clsInterfaces;
		printInstructions = new ArrayList<String>();
		SetFlags(clsAccess);
	}

	
	private void SetFlags(int accessCode) {
		isPublic = (accessCode & 0x0001) != 0 ? true : false;
		isFinal = (accessCode & 0x0010) != 0 ? true : false;
		isInterface = (accessCode & 0x0200) != 0 ? true : false;
		isAbstract = (accessCode & 0x0400) != 0 ? true : false;
		isSuper = (accessCode & 0x0400) != 0 ? true : false;
	}
	
	public int GetAccessCode() {
		return this.access;
	}
	
	public String GetName() {
		return this.name;
	}

	public String GetSuperName() {
		return this.superName;
	}

	public String GetSignature() {
		return this.signature;
	}
	
	public String[] GetInterfaces() {
		return this.interfaces;
	}
	
	public List<String> GetInstructions() {
		return this.printInstructions;
	}

	
	public void SetAccessCode(int accessCode) {
		this.access = accessCode;
		SetFlags(accessCode);
	}
	
	public void SetName(String clsName) {
		this.name = clsName;
	}

	public void SetSignature(String clsSign) {
		this.signature = clsSign;
	}

	public void SetSuperName(String superName) {
		this.superName = superName;
	}

	public void SetInterfaces(String[] interfaces) {
		this.interfaces = interfaces;
	}

	public void AddPrintInstructions(String ins) {
		if(ins != null)
			printInstructions.add(ins);
		return;
	}

	public void AddPrintInstructions(List<String> ins) {
		if(ins != null)
			printInstructions.addAll(ins);
		return;
	}
	
}
